package br.edu.univas.jobmanager.entity;

// Generated 25/06/2011 19:15:54 by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Categoria generated by hbm2java
 */
@Entity
@Table(name = "CATEGORIA", schema = "PUBLIC", catalog = "PUBLIC", uniqueConstraints = @UniqueConstraint(columnNames = "NOME"))
public class Categoria implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer idCategoria;
	private String nome;
	private Set<Tarefa> tarefas = new HashSet<Tarefa>(0);

	public Categoria() {
	}

	public Categoria(String nome, Set<Tarefa> tarefas) {
		this.nome = nome;
		this.tarefas = tarefas;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID_CATEGORIA", unique = true, nullable = false)
	public Integer getIdCategoria() {
		return this.idCategoria;
	}

	public void setIdCategoria(Integer idCategoria) {
		this.idCategoria = idCategoria;
	}

	@Column(name = "NOME", unique = true, length = 20)
	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "categoria")
	public Set<Tarefa> getTarefas() {
		return this.tarefas;
	}

	public void setTarefas(Set<Tarefa> tarefas) {
		this.tarefas = tarefas;
	}
	@Override
	public String toString() {
		return getNome();
	}
}
